package com.woniuxy.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniuxy.entity.Comments;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


public interface CommentsMapper extends BaseMapper<Comments> {
    @Insert("insert into sys_cinema_comments values (#{movieId},#{next})")
    void add(@Param("movieId")Integer movieId,@Param("next") Long next);
    @Select("SELECT sys_comments.* FROM sys_cinema_comments,sys_comments WHERE sys_cinema_comments.comments_id = sys_comments.id AND sys_cinema_comments.cinema_id = #{cinemaid}")
    List<Comments> getByCinemaComments(@Param("cinemaid") Integer cinemaid);
    @Insert("insert into sys_comments values (#{id},#{userId},#{content})")
    void addComments(@Param("id") Long id,@Param("userId") int userId,@Param("content") String content);
}
